<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: pcl::io::MedianBuffer&lt; T &gt; 模板类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classpcl_1_1io_1_1_median_buffer.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pri-static-methods">静态 Private 成员函数</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classpcl_1_1io_1_1_median_buffer-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">pcl::io::MedianBuffer&lt; T &gt; 模板类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="buffers_8h_source.html">buffers.h</a>&gt;</code></p>
<div class="dynheader">
类 pcl::io::MedianBuffer&lt; T &gt; 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classpcl_1_1io_1_1_median_buffer.png" usemap="#pcl::io::MedianBuffer_3C_20T_20_3E_map" alt=""/>
  <map id="pcl::io::MedianBuffer_3C_20T_20_3E_map" name="pcl::io::MedianBuffer_3C_20T_20_3E_map">
<area href="classpcl_1_1io_1_1_buffer.html" alt="pcl::io::Buffer&lt; T &gt;" shape="rect" coords="0,0,159,24"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a04310f33eb143ab54d938e6e6a8281e4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a04310f33eb143ab54d938e6e6a8281e4">MedianBuffer</a> (size_t <a class="el" href="classpcl_1_1io_1_1_buffer.html#a61d65111674c6735f4bffb1e6fcd4221">size</a>, unsigned char window_size)</td></tr>
<tr class="separator:a04310f33eb143ab54d938e6e6a8281e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae8f2c96d2c25ad8b7e6dc07fc835b8aa"><td class="memItemLeft" align="right" valign="top">virtual T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#ae8f2c96d2c25ad8b7e6dc07fc835b8aa">operator[]</a> (size_t idx) const</td></tr>
<tr class="separator:ae8f2c96d2c25ad8b7e6dc07fc835b8aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b36c0edcceab774b2b0d597f641ba7b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a7b36c0edcceab774b2b0d597f641ba7b">push</a> (std::vector&lt; T &gt; &amp;data)</td></tr>
<tr class="separator:a7b36c0edcceab774b2b0d597f641ba7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classpcl_1_1io_1_1_buffer"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classpcl_1_1io_1_1_buffer')"><img src="closed.png" alt="-"/>&#160;Public 成员函数 继承自 <a class="el" href="classpcl_1_1io_1_1_buffer.html">pcl::io::Buffer&lt; T &gt;</a></td></tr>
<tr class="memitem:a61d65111674c6735f4bffb1e6fcd4221 inherit pub_methods_classpcl_1_1io_1_1_buffer"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_buffer.html#a61d65111674c6735f4bffb1e6fcd4221">size</a> () const</td></tr>
<tr class="separator:a61d65111674c6735f4bffb1e6fcd4221 inherit pub_methods_classpcl_1_1io_1_1_buffer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-static-methods"></a>
静态 Private 成员函数</h2></td></tr>
<tr class="memitem:a7713f7ad90ff3464963380ae7cca9698"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">compare</a> (T a, T b)</td></tr>
<tr class="separator:a7713f7ad90ff3464963380ae7cca9698"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:a354b131717bdbdb4730e8f23857a664b"><td class="memItemLeft" align="right" valign="top"><a id="a354b131717bdbdb4730e8f23857a664b"></a>
const unsigned char&#160;</td><td class="memItemRight" valign="bottom"><b>window_size_</b></td></tr>
<tr class="separator:a354b131717bdbdb4730e8f23857a664b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab54a0ed182a6bbc33f01f8afda301764"><td class="memItemLeft" align="right" valign="top"><a id="ab54a0ed182a6bbc33f01f8afda301764"></a>
const unsigned char&#160;</td><td class="memItemRight" valign="bottom"><b>midpoint_</b></td></tr>
<tr class="separator:ab54a0ed182a6bbc33f01f8afda301764"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c5cfd21a27ab064610aabe746e501d3"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::vector&lt; T &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a></td></tr>
<tr class="separator:a5c5cfd21a27ab064610aabe746e501d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1beb98ff4ccbbef84f0022a5360819a9"><td class="memItemLeft" align="right" valign="top"><a id="a1beb98ff4ccbbef84f0022a5360819a9"></a>
unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a></td></tr>
<tr class="memdesc:a1beb98ff4ccbbef84f0022a5360819a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Index of the last pushed data chunk in the data_ circular buffer <br /></td></tr>
<tr class="separator:a1beb98ff4ccbbef84f0022a5360819a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a490a7e4cd7289584ff2f05e5242c3745"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::vector&lt; unsigned char &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a></td></tr>
<tr class="separator:a490a7e4cd7289584ff2f05e5242c3745"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a041934f48e2ffde1680c678dcbdbbe93"><td class="memItemLeft" align="right" valign="top"><a id="a041934f48e2ffde1680c678dcbdbbe93"></a>
std::vector&lt; unsigned char &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">data_invalid_count_</a></td></tr>
<tr class="memdesc:a041934f48e2ffde1680c678dcbdbbe93"><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of invalid values in the buffer <br /></td></tr>
<tr class="separator:a041934f48e2ffde1680c678dcbdbbe93"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f98bc5d63d4b6bd18a11637502a7421"><td class="memItemLeft" align="right" valign="top"><a id="a5f98bc5d63d4b6bd18a11637502a7421"></a>
boost::mutex&#160;</td><td class="memItemRight" valign="bottom"><b>data_mutex_</b></td></tr>
<tr class="separator:a5f98bc5d63d4b6bd18a11637502a7421"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
额外继承的成员函数</h2></td></tr>
<tr class="inherit_header pub_types_classpcl_1_1io_1_1_buffer"><td colspan="2" onclick="javascript:toggleInherit('pub_types_classpcl_1_1io_1_1_buffer')"><img src="closed.png" alt="-"/>&#160;Public 类型 继承自 <a class="el" href="classpcl_1_1io_1_1_buffer.html">pcl::io::Buffer&lt; T &gt;</a></td></tr>
<tr class="memitem:aea0db301ba9eb0f5d13d0f81728cc92d inherit pub_types_classpcl_1_1io_1_1_buffer"><td class="memItemLeft" align="right" valign="top"><a id="aea0db301ba9eb0f5d13d0f81728cc92d"></a>
typedef T&#160;</td><td class="memItemRight" valign="bottom"><b>value_type</b></td></tr>
<tr class="separator:aea0db301ba9eb0f5d13d0f81728cc92d inherit pub_types_classpcl_1_1io_1_1_buffer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_methods_classpcl_1_1io_1_1_buffer"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classpcl_1_1io_1_1_buffer')"><img src="closed.png" alt="-"/>&#160;Protected 成员函数 继承自 <a class="el" href="classpcl_1_1io_1_1_buffer.html">pcl::io::Buffer&lt; T &gt;</a></td></tr>
<tr class="memitem:a6a4ddaecba10826b2e4c71cb6ed8774b inherit pro_methods_classpcl_1_1io_1_1_buffer"><td class="memItemLeft" align="right" valign="top"><a id="a6a4ddaecba10826b2e4c71cb6ed8774b"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Buffer</b> (size_t <a class="el" href="classpcl_1_1io_1_1_buffer.html#a61d65111674c6735f4bffb1e6fcd4221">size</a>)</td></tr>
<tr class="separator:a6a4ddaecba10826b2e4c71cb6ed8774b inherit pro_methods_classpcl_1_1io_1_1_buffer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_classpcl_1_1io_1_1_buffer"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_classpcl_1_1io_1_1_buffer')"><img src="closed.png" alt="-"/>&#160;Protected 属性 继承自 <a class="el" href="classpcl_1_1io_1_1_buffer.html">pcl::io::Buffer&lt; T &gt;</a></td></tr>
<tr class="memitem:a22b520a614821071485fb7349f194fc9 inherit pro_attribs_classpcl_1_1io_1_1_buffer"><td class="memItemLeft" align="right" valign="top"><a id="a22b520a614821071485fb7349f194fc9"></a>
const size_t&#160;</td><td class="memItemRight" valign="bottom"><b>size_</b></td></tr>
<tr class="separator:a22b520a614821071485fb7349f194fc9 inherit pro_attribs_classpcl_1_1io_1_1_buffer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><h3>template&lt;typename T&gt;<br />
class pcl::io::MedianBuffer&lt; T &gt;</h3>

<p>A buffer that computes running window median of the data inserted.</p>
<p>The buffer and window sizes are specified at construction time. The buffer size defines the number of elements in each data chunk that is inserted in the buffer. The window size is the number of last data chunks that are considered for median computation. The median is computed separately for 1st, 2nd, etc. element in data chunks.</p>
<p>The data can contain invalid elements. For integral types zeros are assumed to be invalid elements, whereas for floating-point types it is quiet NaN. Invalid elements are ignored when computing median.</p>
<p>The buffer is thread-safe. </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a04310f33eb143ab54d938e6e6a8281e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a04310f33eb143ab54d938e6e6a8281e4">&#9670;&nbsp;</a></span>MedianBuffer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::<a class="el" href="classpcl_1_1io_1_1_median_buffer.html">MedianBuffer</a> </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>window_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Construct a buffer of given size with given running window size.</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>buffer size </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">window_size</td><td>running window size over which the median value should be computed (0..255) </td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;: Buffer&lt;T&gt; (<a class="code" href="classpcl_1_1io_1_1_buffer.html#a61d65111674c6735f4bffb1e6fcd4221">size</a>)</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;, window_size_ (window_size)</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;, midpoint_ (window_size_ / 2)</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;, <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a> (window_size_ - 1)</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;{</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  assert (size_ &gt; 0);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  assert (window_size_ &gt; 0);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>.resize (window_size_);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; window_size_; ++i)</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[i].resize (size_, <a class="code" href="structbuffer__traits.html">buffer_traits&lt;T&gt;::invalid</a> ());</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a>.resize (size_);</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size_; ++i)</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  {</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a>[i].resize (window_size_);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; window_size_; ++j)</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a>[i][j] = j;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  }</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160; </div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">data_invalid_count_</a>.resize (size_, window_size_);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;}</div>
<div class="ttc" id="aclasspcl_1_1io_1_1_buffer_html_a61d65111674c6735f4bffb1e6fcd4221"><div class="ttname"><a href="classpcl_1_1io_1_1_buffer.html#a61d65111674c6735f4bffb1e6fcd4221">pcl::io::Buffer::size</a></div><div class="ttdeci">size_t size() const</div><div class="ttdef"><b>Definition:</b> buffers.h:91</div></div>
<div class="ttc" id="aclasspcl_1_1io_1_1_median_buffer_html_a041934f48e2ffde1680c678dcbdbbe93"><div class="ttname"><a href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">pcl::io::MedianBuffer::data_invalid_count_</a></div><div class="ttdeci">std::vector&lt; unsigned char &gt; data_invalid_count_</div><div class="ttdoc">Number of invalid values in the buffer</div><div class="ttdef"><b>Definition:</b> buffers.h:202</div></div>
<div class="ttc" id="aclasspcl_1_1io_1_1_median_buffer_html_a1beb98ff4ccbbef84f0022a5360819a9"><div class="ttname"><a href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">pcl::io::MedianBuffer::data_current_idx_</a></div><div class="ttdeci">unsigned char data_current_idx_</div><div class="ttdoc">Index of the last pushed data chunk in the data_ circular buffer</div><div class="ttdef"><b>Definition:</b> buffers.h:195</div></div>
<div class="ttc" id="aclasspcl_1_1io_1_1_median_buffer_html_a490a7e4cd7289584ff2f05e5242c3745"><div class="ttname"><a href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">pcl::io::MedianBuffer::data_argsort_indices_</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; unsigned char &gt; &gt; data_argsort_indices_</div><div class="ttdef"><b>Definition:</b> buffers.h:199</div></div>
<div class="ttc" id="aclasspcl_1_1io_1_1_median_buffer_html_a5c5cfd21a27ab064610aabe746e501d3"><div class="ttname"><a href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">pcl::io::MedianBuffer::data_</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; T &gt; &gt; data_</div><div class="ttdef"><b>Definition:</b> buffers.h:192</div></div>
<div class="ttc" id="astructbuffer__traits_html"><div class="ttname"><a href="structbuffer__traits.html">buffer_traits</a></div><div class="ttdef"><b>Definition:</b> buffers.hpp:48</div></div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a7713f7ad90ff3464963380ae7cca9698"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7713f7ad90ff3464963380ae7cca9698">&#9670;&nbsp;</a></span>compare()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::compare </td>
          <td>(</td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Compare two data elements.</p>
<p>Invalid value is assumed to be larger than everything else. If both values are invalid, they are assumed to be equal.</p>
<dl class="section return"><dt>返回</dt><dd>-1 if <code>a</code> &lt; <code>b</code>, 0 if <code>a</code> == <code>b</code>, 1 if <code>a</code> &gt; <code>b</code> </dd></dl>
<div class="fragment"><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;{</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;  <span class="keywordtype">bool</span> a_is_invalid = <a class="code" href="structbuffer__traits.html">buffer_traits&lt;T&gt;::is_invalid</a> (a);</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;  <span class="keywordtype">bool</span> b_is_invalid = <a class="code" href="structbuffer__traits.html">buffer_traits&lt;T&gt;::is_invalid</a> (b);</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;  <span class="keywordflow">if</span> (a_is_invalid &amp;&amp; b_is_invalid)</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;  <span class="keywordflow">if</span> (a_is_invalid)</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;  <span class="keywordflow">if</span> (b_is_invalid)</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;  <span class="keywordflow">if</span> (a == b)</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;  <span class="keywordflow">return</span> a &gt; b ? 1 : -1;</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae8f2c96d2c25ad8b7e6dc07fc835b8aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae8f2c96d2c25ad8b7e6dc07fc835b8aa">&#9670;&nbsp;</a></span>operator[]()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::operator[] </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>idx</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Access an element at a given index.</p>
<p>This operation is constant time. </p>

<p>实现了 <a class="el" href="classpcl_1_1io_1_1_buffer.html#aae263e2a2c1ad9a00e969107e6114144">pcl::io::Buffer&lt; T &gt;</a>.</p>
<div class="fragment"><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;{</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;  assert (idx &lt; size_);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="keywordtype">int</span> midpoint = (window_size_ - <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">data_invalid_count_</a>[idx]) / 2;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;  <span class="keywordflow">return</span> (<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a>[idx][midpoint]][idx]);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a7b36c0edcceab774b2b0d597f641ba7b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b36c0edcceab774b2b0d597f641ba7b">&#9670;&nbsp;</a></span>push()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::push </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; T &gt; &amp;&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Insert a new chunk of data into the buffer.</p>
<p>This operation is linear in buffer size and window size.</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>input data chunk, the memory will be "stolen" </td></tr>
  </table>
  </dd>
</dl>

<p>实现了 <a class="el" href="classpcl_1_1io_1_1_buffer.html#a7c5fe095483e68f8f0236c735bb26f01">pcl::io::Buffer&lt; T &gt;</a>.</p>
<div class="fragment"><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;{</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  assert (data.size () == size_);</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;  boost::mutex::scoped_lock lock (data_mutex_);</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;  <span class="keywordflow">if</span> (++<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a> &gt;= window_size_)</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a> = 0;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160; </div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;  <span class="comment">// New data will replace the column with index data_current_idx_. Before</span></div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  <span class="comment">// overwriting it, we go through all the new-old value pairs and update</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  <span class="comment">// data_argsort_indices_ to maintain sorted order.</span></div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size_; ++i)</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;  {</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    <span class="keyword">const</span> T&amp; new_value = data[i];</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    <span class="keyword">const</span> T&amp; old_value = <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a>][i];</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    <span class="keywordtype">bool</span> new_is_invalid = <a class="code" href="structbuffer__traits.html">buffer_traits&lt;T&gt;::is_invalid</a> (new_value);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordtype">bool</span> old_is_invalid = <a class="code" href="structbuffer__traits.html">buffer_traits&lt;T&gt;::is_invalid</a> (old_value);</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">compare</a> (new_value, old_value) == 0)</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;      <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    std::vector&lt;unsigned char&gt;&amp; argsort_indices = <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a490a7e4cd7289584ff2f05e5242c3745">data_argsort_indices_</a>[i];</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="comment">// Rewrite the argsort indices before or after the position where we insert</span></div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="comment">// depending on the relation between the old and new values</span></div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">compare</a> (new_value, old_value) == 1)</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    {</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; window_size_; ++j)</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        <span class="keywordflow">if</span> (argsort_indices[j] == <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a>)</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;        {</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;          <span class="keywordtype">int</span> k = j + 1;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;          <span class="keywordflow">while</span> (k &lt; window_size_ &amp;&amp; <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">compare</a> (new_value, <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[argsort_indices[k]][i]) == 1)</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;          {</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            std::swap (argsort_indices[k - 1], argsort_indices[k]);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;            ++k;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;          }</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        }</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    }</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    {</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = window_size_ - 1; j &gt;= 0; --j)</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;        <span class="keywordflow">if</span> (argsort_indices[j] == <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a>)</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;        {</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;          <span class="keywordtype">int</span> k = j - 1;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;          <span class="keywordflow">while</span> (k &gt;= 0 &amp;&amp; <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">compare</a> (new_value, <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[argsort_indices[k]][i]) == -1)</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;          {</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            std::swap (argsort_indices[k], argsort_indices[k + 1]);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            --k;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;          }</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;        }</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    }</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160; </div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <span class="keywordflow">if</span> (new_is_invalid &amp;&amp; !old_is_invalid)</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;      ++<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">data_invalid_count_</a>[i];</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!new_is_invalid &amp;&amp; old_is_invalid)</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;      --<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a041934f48e2ffde1680c678dcbdbbe93">data_invalid_count_</a>[i];</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;  }</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160; </div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;  <span class="comment">// Finally overwrite the data</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;  <a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a5c5cfd21a27ab064610aabe746e501d3">data_</a>[<a class="code" href="classpcl_1_1io_1_1_median_buffer.html#a1beb98ff4ccbbef84f0022a5360819a9">data_current_idx_</a>].swap (data);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;  data.clear ();</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;}</div>
<div class="ttc" id="aclasspcl_1_1io_1_1_median_buffer_html_a7713f7ad90ff3464963380ae7cca9698"><div class="ttname"><a href="classpcl_1_1io_1_1_median_buffer.html#a7713f7ad90ff3464963380ae7cca9698">pcl::io::MedianBuffer::compare</a></div><div class="ttdeci">static int compare(T a, T b)</div><div class="ttdef"><b>Definition:</b> buffers.hpp:209</div></div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="a5c5cfd21a27ab064610aabe746e501d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c5cfd21a27ab064610aabe746e501d3">&#9670;&nbsp;</a></span>data_</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;std::vector&lt;T&gt; &gt; <a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::data_</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Data pushed into the buffer (last window_size_ chunks), logically organized as a circular buffer </p>

</div>
</div>
<a id="a490a7e4cd7289584ff2f05e5242c3745"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a490a7e4cd7289584ff2f05e5242c3745">&#9670;&nbsp;</a></span>data_argsort_indices_</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;std::vector&lt;unsigned char&gt; &gt; <a class="el" href="classpcl_1_1io_1_1_median_buffer.html">pcl::io::MedianBuffer</a>&lt; T &gt;::data_argsort_indices_</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Indices that the argsort function would produce for data_ (with dimensions swapped) </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>io/include/pcl/io/<a class="el" href="buffers_8h_source.html">buffers.h</a></li>
<li>io/include/pcl/io/impl/<a class="el" href="buffers_8hpp_source.html">buffers.hpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>pcl</b></li><li class="navelem"><b>io</b></li><li class="navelem"><a class="el" href="classpcl_1_1io_1_1_median_buffer.html">MedianBuffer</a></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
